<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var obj = new Object();
        obj.uname = '李嘉台';
        obj.age = 18;
        obj.sayHello = function () {
            console.log('hello');
        }

        for (var k in obj) {
            console.log(k);// 输出的是属性名
            console.log(obj[k]); // 得到的是属性值
        }
    </script>
</head>

<body>

</body>

</html>